/**
 * Created by Blink on 2017/7/20.
 * navigation list item
 */

import * as React from "react";
import Icon from "./blink.icon";

export default class NavigationItem extends React.Component {


    render() {
        const {active, icon, text, index,
            onClick, onMouseEnter} = this.props;

        return (
            <li className={active ? 'active' : ''} ref={(li) => {this.dom = li}}
                onClick={(e) => {
                    if (onClick) onClick(index, e.target);
                }}
                onMouseEnter={(e) => {
                    if (onMouseEnter) onMouseEnter(index, e.target);
                }}
            >
                { icon ? <Icon name={icon}/> : null }
                {text}
            </li>
        )
    }
}
